import java.sql.Time;
import java.util.Currency;
import java.util.Random;
import java.util.TreeMap;

/*
public class Test {
    private static long sum1= 0;
    private static long sum2= 0;
    public static void main(String[] args) throws InterruptedException {
        long start = System.currentTimeMillis();
        long[] arr = new long[(int)1e7];
        for(long i =0;i<(long)1e7;i++) {
            Random random = new Random();
            arr[(int) i] = random.nextInt(100);
        }
        Thread t1 = new Thread(()-> {

            for (long i=0;i<(long)1e7;i+=2) {
                sum1+=arr[(int)i];
            }
        });

        Thread t2 = new Thread(()-> {

            for (long i=1;i<(long)1e7;i+=2) {
                sum2+=arr[(int)i];
            }
        });
        t1.start();
        t1.join();
        t2.start();
        t2.join();
        long end = System.currentTimeMillis();
        System.out.println("总耗时长："+(end - start));
        System.out.println("总长度"+sum1+sum2);
    }

}
*/

/*public class Test {
    private static long sum1 = 0;
    private static long sum2 = 0;

    public static void main(String[] args) throws InterruptedException {
        long start = System.currentTimeMillis();
        long[] arr = new long[(int) 1e7];
        Random random = new Random(); // 创建一个随机数生成器，避免在循环中重复创建

        // 填充数组
        for (int i = 0; i < 1e7; i++) {
            arr[i] = random.nextInt(100);
        }

        Thread t1 = new Thread(() -> {
            for (long i = 0; i < 1e7; i += 2) {
                sum1 += arr[(int) i];
            }
        });

        Thread t2 = new Thread(() -> {
            for (long i = 1; i < 1e7; i += 2) {
                sum2 += arr[(int) i];
            }
        });

        t1.start();
        t2.start();

        t1.join();
        t2.join();

        long end = System.currentTimeMillis();
        System.out.println("总耗时长：" + (end - start));
        System.out.println("总长度：" + (sum1 + sum2));
    }
}*/


